<form class="form-inline" method="get">
    <div class="form-group col-xs-2">
        <div class="col-xs-12">
            <input class="form-control" name="title" value="{$title}"
                   placeholder="标题">
        </div>
    </div>

    <div class="form-group col-xs-4">

        <button type="submit" class="btn btn-success">
            搜索
        </button>

        <button type="button" class="btn btn-primary" onclick="modal('{:url(\'add\')}','添加单页')">
            添加单页
        </button>
    </div>
</form>

<hr>

<table class="table table-striped">
    <thead>
    <tr>
        <td>ID</td>
        <td>标题</td>
        <td>跳转地址</td>
        <td>是否显示</td>
        <td>编辑时间</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>
    {volist name="list" id="item"}
    <tr>
        <td>{$item.id}</td>
        <td>{$item.title}</td>

        <td style="max-width:150px;word-break: break-all">
            {$item.jump_url}
        </td>
        <td>
            {if $item["is_visible"]}
            <label class="label label-success" data-toggle="ajaxSwitch" data-switch-status="1"
                   data-switch-value-0="1|显示|label label-success|{:url('visible',array('id'=>$item['id'],'status'=>1))}"
                   data-switch-value-1="0|隐藏|label label-danger|{:url('visible',array('id'=>$item['id'],'status'=>0))}">显示</label>
            {else}
            <label class="label label-danger" data-toggle="ajaxSwitch" data-switch-status="0"
                   data-switch-value-0="1|显示|label label-success|{:url('visible',array('id'=>$item['id'],'status'=>1))}"
                   data-switch-value-1="0|隐藏|label label-danger|{:url('visible',array('id'=>$item['id'],'status'=>0))}">隐藏</label>
            {/if}
        </td>
        <td>{$item.update_time|show_datetime}</td>
        <td>

            <a href="javascript:void(0)" class="btn btn-primary btn-sm"
               onclick="modal('{:url(\'edit\',array(\'id\'=>$item[\'id\']))}','编辑单页')">编辑</a>
            <a href="javascript:void(0)" class="btn btn-danger btn-sm" data-toggle="confirm" data-title="删除"
               data-content="确定要删除吗？删除将彻底删除，不可恢复"
               data-url="{:url('remove',array('id'=>$item['id']))}">删除</a>

        </td>
    </tr>
    {/volist}
    </tbody>
</table>

<div class="row">
    <div class="col-xs-12" style="text-align: right;">
        {$list->render()}
    </div>
</div>

<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<script type="application/javascript">
    $(function () {

        $("#is-visible-selector").select2({
            placeholder: "选择是否显示",
            allowClear: true
        });
    });
</script>